home *** CD-ROM | disk | FTP | other *** search
/ Micromanía 92 / CDMM92_1.ISO / SOF 2 SDK / sof2sdk-101.msi / _92D6AC311BB48EBA344BBABC89DA6AB0 / _A01C23DB42EC40338D36F748CF7536B8 < prev    next >
Encoding:
Text File  |  2002-04-23  |  16.4 KB  |  331 lines

  1. #pragma once
  2. #if !defined(IGINTERFACE_H_INC)
  3. #define IGINTERFACE_H_INC
  4.  
  5.  
  6. #if !defined(G_ICARUS_H_INC)
  7.     #include "../newgame/g_icarus.h"
  8. #endif
  9.  
  10. class CICARUSGameInterface
  11. {
  12.  
  13. /************************************************************************************************
  14.  *    CICARUSGameInterface:                                                                        *
  15.  *                                                                                                *
  16.  *    Contains member functions which correspond to function pointers in Q3_Interface.cpp.        *
  17.  *                                                                                                *
  18.  *                                                                                                *
  19.  *                                                                                              *
  20.  ************************************************************************************************/
  21.  
  22.  
  23. public:
  24.  
  25.             CICARUSGameInterface(void) {};
  26.             ~CICARUSGameInterface(void){};
  27.  
  28. static void        DebugPrint( int level, const char *format, ... );
  29. static CSequencer    *GetEntitySequencerByName( const char *name );
  30. static DWORD        GetTime( void );
  31. static void        Lerp2Pos( int taskID, int entID, vec3_t origin, vec3_t angles, float duration );
  32. static void        Lerp2Angles( int taskID, int entID, vec3_t angles, float duration );
  33. static bool        PlaySound( int taskID, int entID, const char *name, const char *channel );
  34. static void        TaskIDSet( CEntity *ent, taskID_t taskType, int taskID );
  35. static void        TaskIDComplete( CEntity *ent, taskID_t taskType );
  36. static void        TaskIDClear( int *taskID );
  37. static bool        TaskIDPending( CEntity *ent, taskID_t taskType );
  38. static void        Remove( int entID, int parentID, const char *name );
  39. static bool        GetTag( int entID, const char *name, int lookup, vec3_t info, int parentID );
  40. static int        GetFloat( int entID, int type, const char *name, float *value );
  41. static int        GetVector( int entID, int type, const char *name, vec3_t value );
  42. static int        GetString( int entID, int type, const char *name, const char **value );
  43. static int        Evaluate( int p1Type, const char *p1, int p2Type, const char *p2, int operatorType );
  44. static void        DeclareVariable( int type, const char *name );
  45. static void        FreeVariable( const char *name );
  46. static void        Set( int taskID, int entID, const char *type_name, const char *data );
  47. static void        Use( int entID, int parentID, const char *target );
  48. static void        Play( int taskID, int entID, const char *type, const char *name );
  49. static void        *Malloc( int size, int tag );
  50. static void        Free( void *memory );
  51. static void        Cam_Enable( void );
  52. static void        Cam_Disable( void );
  53. static void        Cam_Zoom( float fov, float duration );
  54. static void        Cam_Move( vec3_t origin, float duration );
  55. static void        Cam_Pan( vec3_t angles, vec3_t dir, float duration );
  56. static void        Cam_Roll( float angle, float duration );
  57. static void        Cam_Track( const char *name, float speed, float initLerp, int taskID );
  58. static void        Cam_Follow( const char *name, float speed, float initLerp );
  59. static void        Cam_Distance( float dist, float initLerp );
  60. static void        Cam_Shake( float intensity, int duration );
  61. static void        Cam_Fade( float sr, float sg, float sb, float sa, float dr, float dg, float db, float da, float duration );
  62. static void        Cam_Path( const char *name, int taskID, bool trans=false);
  63. static int        GetBoltID( const char *boltname);
  64. static int        GetHitID( const char *name);
  65. static int        GetScript( const char *name, void **buf );
  66. static int        ICARUS_LinkEntity( int entID, CSequencer *sequencer, CTaskManager *taskManager );
  67. static int        AddToPendingAnims(int t)
  68. {
  69.     CICARUSGameInterface::GetPendingAnims().push_back(t);
  70.     return 0;
  71. }
  72. static int        ClosePendingAnims();
  73.  
  74. static vector<int> &GetPendingAnims(void) 
  75.     static    vector<int>            mPendingAnims;
  76.     return(mPendingAnims); 
  77. }
  78.  
  79.  
  80. static string    &GetCurPackage();
  81. };
  82.  
  83. //external functions
  84. bool    TAG_GetOrigin( const char *name, const char *instance, vec3_t origin );
  85. bool    TAG_GetAngles( const char *name, const char *instance, vec3_t angles );
  86.  
  87. void    IG_SetPrintToken( int entID, const char *data );
  88. void    IG_SetStringPackage( int entID, const char *data );
  89.  
  90. //NOTENOTE: The enums and tables in this file will obviously complain if they are included multiple times, don't do that
  91.  
  92. typedef enum //# setType_e
  93. {
  94.     //# #sep Parm strings
  95.     SET_PARM1 = 0,//## %s="" # Set entity parm1
  96.     SET_PARM2,//## %s="" # Set entity parm2
  97.     SET_PARM3,//## %s="" # Set entity parm3
  98.     SET_PARM4,//## %s="" # Set entity parm4
  99.     SET_PARM5,//## %s="" # Set entity parm5
  100.     SET_PARM6,//## %s="" # Set entity parm6
  101.     SET_PARM7,//## %s="" # Set entity parm7
  102.     SET_PARM8,//## %s="" # Set entity parm8
  103.  
  104.     //# #Console commands, subtitle commands
  105.     SET_DISCONNECT, //## #send disconnect
  106.     SET_MAINMENU, //## #go to main menu
  107.     SET_CONSOLE_COMMAND, //## %s="NULL" # Issue this command to the console
  108.     SET_CVAR, //## %s="CVAR_NAME VALUE" # Change this CVAR_NAME to the following VALUE
  109.     SET_STRING_PACKAGE, //## %s="NULL" # Name of the string package for tokens
  110.     SET_PRINT_TOKEN, //## %s="NULL" # Name of token to print out as subtitle
  111.     SET_MUSIC_PERCENTAGE, //## %f="0.0" # Set the music to be this percetage of what it currently is (e.g. .5 will turn it down 1/2 of current volume)
  112.     SET_HUD_MAIN, //## %s="NULL" # name of Hud to set 
  113.     SET_HUD_WEAPONS, //## %s="NULL" # name of Hud to set 
  114.     SET_PLAYERHEALTH_OLD, //## #call this if you want to set the player health to g_playerHealthOld
  115.     SET_PLAYERARMOR_OLD, //## #call this if you want to set the player armor to g_playerArmorOld
  116.     SET_SAVE_PLAYERHEALTH, //## #call this if you want to save the player health to g_playerHealthOld
  117.     SET_SAVE_PLAYERARMOR, //## #call this if you want to savethe player armor to g_playerArmorOld
  118.  
  119.     SET_WORLD_DEATH_PAUSE, //## #call this to freeze the world, intended for death scripts (ideal after fading out)
  120.  
  121.  
  122.     // NOTE!!! If you add any other SET_xxxxxxSCRIPT types, make sure you update the 'case' statements in 
  123.     //    ICARUS_InterrogateScript() (game/g_ICARUS.cpp), or the script-precacher won't find them.
  124.     //# #sep Scripts and other file paths
  125.     //SET_SPAWNSCRIPT,//## %s="NULL" !!"Q:\quake\baseEF\real_scripts\!!#*.txt" # Script to run when spawned //0 - do not change these, these are equal to BSET_SPAWN, etc
  126.     //SET_USE_SCRIPT,//## %s !!"S:\base\scripts\!!#*.txt" # Script to run when used        
  127.     SET_PLAYER_USE_SCRIPT,//## %s !!"S:\base\scripts\!!#*.txt" # Script to run when player uses        
  128.     SET_DEATH_SCRIPT,//## %s !!"S:\base\scripts\!!#*.txt" # Script to run when used    
  129.     SET_PAIN_SCRIPT,//## %s !!"S:\base\scripts\!!#*.txt" # Script to run when used    
  130.     SET_SPAWN_SCRIPT,//## %s !!"S:\base\scripts\!!#*.txt" # Script to run when used    
  131.     SET_VIEW_SCRIPT,//## %s="NULL" !!"S:\base\scripts\!!#*.txt" # Script to run when NPC sees enemy    
  132.     SET_ANY_VIEW_SCRIPT,//## %s="NULL" !!"S:\base\scripts\!!#*.txt" # Script to run when NPC sees any NPC or player
  133.     SET_PLAYER_VIEW_SCRIPT,//## %s="NULL" !!"S:\base\scripts\!!#*.txt" # Script to run when NPC sees player
  134.     SET_HEAR_SCRIPT,//## %s="NULL" !!"S:\base\scripts\!!#*.txt" # Script to run when NPC hears any enemy or player
  135.     SET_KO_SCRIPT,//## %s="NULL" !!"S:\base\scripts\!!#*.txt" # Script to run when NPC is knocked out
  136.     SET_CONTACT_SCRIPT,//## %s="NULL" !!"S:\base\scripts\!!#*.txt" # Script to run when NPC sees enemy or evidence of enemy
  137.     SET_WORLD_HEAR_SCRIPT,//## %s="NULL" !!"S:\base\scripts\!!#*.txt" # Script to run first time player sound is above 0.7
  138.     SET_PLAYER_CAM_DEATH,//## %t="BOOL_TYPES" # turn the player death camera (roff for dropping player to ground) OFF or ON (defaults ON)
  139.  
  140.     //# #sep Standard strings    
  141.     SET_NAME,//## %s="NULL" # Set/change your targetname
  142.     SET_CAMERA_GROUP,//## %s="NULL" # Set/change your cameraGroup for camera FOLLOW commands
  143.     SET_FACE_TARGET, //## %s="NULL" # Set/change your face target (NOT supported for npc's)
  144.     SET_ENEMY, //## %s="NULL" # Set/change your enemy
  145.     SET_HITLOC, //## %t="HITLOC" # Set/change your hit location (for shooting other NPC's and players)
  146.     SET_FAKEGUN, //## %s="NULL" # Set/change targetname of fake gun (for using SET_HEALTH to kill NPCs)
  147.     SET_PLAYER_VIEW, //## %t="BOOL_TYPES" # attach camera to brush model child (on/off)
  148.     SET_VIEW_PARENT, //## %s="NULL" # Set targetname of brush model for SET_PLAYER_VIEW command
  149.     SET_VIEW_CHILD, //## %s="NULL" # Set targetname of brush model child for SET_PLAYER_VIEW command
  150.     SET_INVIEW_WPN, //## %t="BOOL_TYPES" # toggle inview weapon model (on/off)
  151.     SET_ADD_WPN, //## %s="NULL" # add a weapon to the player's inventory
  152.     SET_REMOVE_WPN, //## %s="NULL" # remove a weapon from the player's inventory
  153.  
  154.     //# #sep booleans
  155.     SET_NOCLIP, //## %t="BOOL_TYPES" # turn noclip on/off
  156.     SET_IGNOREPAIN, //## %t="BOOL_TYPES" # npc will ignore being in pain
  157.     SET_SOUNDBLOCK, //## %t="BOOL_TYPES" # npc will not play any sounds
  158.     SET_INVINCIBLE, //## %t="BOOL_TYPES" # npc will ignore being in pain
  159.     SET_STATIONARY, //## %t="BOOL_TYPES" # turn npc stationary mode on(1) or off(0)
  160.     SET_FORCE_SCRIPT, //## %t="BOOL_TYPES" # turn force script mode on(1) or off(0)
  161.     SET_HIDE, //## %t="BOOL_TYPES" # turn npc hide mode on(1) or off(0)
  162.     SET_ENABLE, //## %t="BOOL_TYPES" # enable/disable affected device (not for NPCs!!!)    
  163.     SET_EMPLACED, //## %s="NULL" # force this entity onto emplaced weapon with targetname, NULL turns off
  164.     SET_RELEASE_ONCONTACT, //## %t="BOOL_TYPES_REL" # npc will be released from script when he sees or is shot by some enemy
  165.     SET_GOAL_RELEASE, //## %t="GOAL_REL" # GO: ignore enemies when in goal, PAUSE: default combat AI for a little while, STOP: default combat AI until enemies gone, default is PAUSE, set pause time with SET_GOAL_PAUSE
  166.     SET_GOAL_PAUSE, //## %f="5000" # For PAUSE mode in goals, NPCs will stop for this many ms and fight bad guys
  167.     SET_NAVIGATION,    //## %t="BOOL_TYPES" # turn navpoint usage on(1) or off(0)
  168.     SET_TASK_FLUSH, //## %t="BOOL_TYPES" # set to ON to flush all pending script tasks
  169.     SET_ROFF_TRANSLATED, //## %t="BOOL_TYPES" # set to ON and when the camera is roffed it will play it translated
  170.     SET_PLAYERALWAYS_HURT, //## %t="BOOL_TYPES" # turn ON ability for player to always hurt this npc, regardless of invicible setting
  171.     SET_SUIT, //## %t="BOOL_TYPES" # turn on/off the biohazard suit fullscreen effect    
  172.  
  173.     SET_MORELIGHT, //## %t="BOOL_TYPES" # turn ON to give this npc a minlight effect
  174.  
  175.     //# #sep vectors
  176.     SET_ORIGIN,//## %v="0.0 0.0 0.0" # Set origin explicitly or with TAG
  177.     SET_ANGLES,//## %v="0.0 0.0 0.0" # Set angles explicitly or with TAG
  178.     SET_MOVE_BY, //## %v="0.0 0.0 0.0" %f="0.0" # Move by vector x,y,z for time t
  179.     SET_MOVE, //## %v="0.0 0.0 0.0" %f="0.0" %f="0.0" # Move in direction x,y,z for d distance and t time
  180.  
  181.     //# #sep floats
  182.     SET_WAIT,        //## %f="0.0" # Change an entity's wait field
  183.     SET_VIEWDIST,    //## %f="0.0" # Change an NPC's viewing distance
  184.     SET_GOALDIST,    //## %f="0.0" # Change a acceptable goal reached distance (set on commanders)    
  185.     SET_RESET_ALL_VIEWDIST, //## %f="1000.0" # Set all NPC's view distances to this value
  186.     SET_ACCURACY,    //## %f="1.0" # Accuracy of NPC
  187.     SET_DAMAGE,        //## %f="1.0" # Damage of NPC
  188.  
  189.     //# #sep ints
  190.     SET_HEALTH,//## %d="0" # Change health
  191.     SET_HEALTHNOANIM,//## %d="0" # Change health but don't play animation for it
  192.     SET_SAVEHEALTH,//## # Saves the health out to prepare for level load, cvar name: health_icarusname
  193.     SET_LOADHEALTH,//## # Loads the health from a previous level, cvar name: health_icarusname
  194.     SET_MAXSHOTS, //## %d="0" # Shots the entity can take before starting to ignore pain, use -1 to not use maxshots
  195.         
  196.  
  197.     //# #sep Animation tables (turn overrides off/on)
  198.  
  199.     SET_ANIM_SEQUENCER, //## %t="BOOL_TYPES" # turns Animation Sequencer on/off
  200.  
  201.     SET_ANIM, //## %s="NULL" # plays an animation this many times (use string provided from SklView)
  202.  
  203.     SET_ANIM_PAIN, //## %t="HITLOC" # When killing/hurting a guy in a script, you can set his death/pain animation here
  204.     
  205.     SET_ANIM_OFF, //## %t="SKEL" # turn animations on this skel off (back to default)
  206.  
  207.     //SET_ANIM_ALL_OFF, //## %t="BOOL_TYPES" # turn all animations on all skelements off (back to default)
  208.  
  209.     SET_ANIM_FLUSH, //## %t="BOOL_TYPES" # flush all animations (returns all to stationary)
  210.  
  211.     SET_ANIM_LOOP,//## %t="BOOL_TYPES"
  212.  
  213.     SET_ANIM_EYES, //## %t="BOOL_TYPES" # set to OFF to stop blinking (use only in special cases- see Ben)
  214.  
  215.     //# #sep Animation tables (override specifics)
  216.  
  217.     SET_MOOD,//## %t="MOOD"
  218.  
  219.     SET_STANCE,//## %t="STANCE"
  220.  
  221.     SET_HAND_SIGNAL,//## %t="HANDSIGNAL"
  222.  
  223.     //# #sep Task/Goal tables
  224.  
  225.     //in-bhc tables
  226.  
  227.     SET_TASK,//## %t="TASK_TYPES" # Set/change your current task
  228.  
  229.     SET_GOAL,//## %t="GOAL_TYPES" # Set/change your team goal (for TeamCommander NPCs)    
  230.  
  231.     SET_GOALFLUSH,    //## %t="BOOL_TYPES" # Set to on(1) to flush goals.  Set to off(0) to again accept goals.    
  232.  
  233.     SET_NAVGOAL,//## %s="NULL" # Set/change your navgoal
  234.  
  235.     SET_NAVGOAL2,//## %s="NULL" # Set/change your 2nd navgoal (mostly for designer assisted Patrols)
  236.     
  237.     SET_NAVGOAL3,//## %s="NULL" # Set/change your 3rd navgoal (mostly for designer assisted Patrols)
  238.  
  239.     SET_AREAGOAL,//## %s="NULL" # Set/change your area goal
  240.  
  241.     SET_AREAGOAL2,//## %s="NULL" # Set/change your secondary area goal (mostly for flank area goal)
  242.  
  243.     SET_VECGOAL,//## %s="NULL" # Set an arbitrary point on the map (x,y,z) to go to.
  244.  
  245.     SET_ENTGOAL,//## %s="NULL" # Set to go to an entity the map.    
  246.  
  247.     SET_ENTGOAL2,//## %s="NULL" # Backup ent goal
  248.     
  249.     SET_ENTGOAL3,//## %s="NULL" # Backup ent goal
  250.  
  251.     SET_ENTGOAL4,//## %s="NULL" # Backup ent goal
  252.  
  253.     SET_INVENTORY_ACTION,//## %t="INVENTORY_ACTION" # Set the type of action to do on the inventory task
  254.  
  255.     SET_TASK_SPEED, //## %t="SPEED" # Set the speed to use in a specified SET_TASK (e.g. walk)
  256.  
  257.     SET_TASK_PAUSE, //## %f="1000" # Set the pause time between navpoints (only supports soldiers/sargeants w/out partners)
  258.  
  259.     SET_ATTACK, //## %t="BOOL_TYPES" # Set to on(1) to attack (same as SET_TASK ATTACK), off(0) to stop attacking
  260.  
  261.     SET_TEAM, //## %t="TEAM_TYPES" # Set this NPC or Player to the given team.
  262.  
  263.     SET_BLOCK_RETRY, //## %f="0" # Set the number of blocks needed before a replan on MoveToEnt- 0 for never replan
  264.  
  265.     //# #sep Face Angles tables
  266.     SET_LOOK_TARGET,//## %s="NULL" # Set/change your current look target (look at this entity)
  267.  
  268.     SET_LOOK_POINT, //## %v="0.0 0.0 0.0" # Set/change your current look target to be this point in space
  269.  
  270.     SET_LOOK_ANGLE, //## %f="0.0" # Set/change your current look target by this degree (e.g. look over 10 degrees)
  271.  
  272.     SET_LOOK_TYPE, //## %t="LOOK_TYPES" # Use this to set the type of looktarget, lookpoint or lookangle you want.
  273.  
  274.     SET_LOOK_OFF, //## %t="LOOK_TYPES" # Use this to turn off a looking command for the given type    
  275.  
  276.     SET_LOOK_PARENT, //## %t="BOOL_TYPES" # Turn on/off parent activation of joint commands (once set, this stays on entity until set again. Default is ON)
  277.  
  278.     SET_LOOK_ROOT, //## %t="BOOL_TYPES" # Turn on/off root activation of joint commands (once set, this stays on entity until set again. Default is ON)
  279.  
  280.     SET_AIM,//## # Aim Gun at Current Focus
  281.  
  282.     SET_SEARCH, //## %v="30.0 50.0 0.0" # Set/change your search angles
  283.  
  284.     SET_SEARCH_OFF, //## #turn off SEARCH
  285.     
  286.     SET_TALK_TO,//## %s="NULL" # Set/change your current talking to target (turn towards this entity to talk to it)
  287.  
  288.     SET_TALK_TO_NOROOT,//## %s="NULL" # THIS IS NO LONGER VALID! use TALK_TO instead and set SET_LOOK_ROOT OFF
  289.  
  290.     SET_SCOTT_MCNUTT, //## %t="MOOD" # Switch Scott McNutt Off or On (use with caution)
  291.  
  292.     SET_SPECIAL_USE, //## %s="NULL" # Set to targetname to use (must be inside Affect of some NPC)
  293.  
  294.     SET_VIOLENCE_USE, //## %s="NULL" # Set to targetname to use (this is a use that will only happen if the violence lock is not on)
  295.  
  296.     SET_CAMERA_NOHUD,  //## %t="BOOL_TYPES" # Set to true to not allow enabling of camera to letterbox screen
  297.  
  298.     //# #sep Defunct or Not yet implemented tables (don't use these)
  299.     SET_WEAPON,//## %t="WEAPON_NAMES" # Change/Stow/Drop weapon (FUTURE USE)
  300.     
  301.     SET_ANGLE_OVERRIDE, //## %t="BOOL_TYPES" # Turn angle overrides on/off (NO LONGER NEEDED!)
  302.     
  303.     SET_TOUCH, //## %s="NULL" # Touch this entity
  304.  
  305.     SET_GOALMODE,//## %t="GOAL_MODES" # Set/change your team goal mode (for TeamCommander NPCs)
  306.  
  307.     //# #eol
  308.     SET_
  309. } setType_t;    
  310.  
  311.  
  312. // this enum isn't used directly by the game, it's mainly for BehavEd to scan for...
  313. //
  314. typedef enum //# playType_e
  315. {
  316.     //# #sep Types of file to play
  317.     PLAY_ROFF = 0,//## %s !!"S:\base\!!scripts\*.rof" # Play a ROFF (not Translated)
  318.  
  319.     PLAY_ROFF_TRANSLATED = 0,//## %s !!"S:\base\!!scripts\*.rof" # Play a ROFF (Translated)
  320.         
  321.  
  322.     //# #eol
  323.     PLAY_NUMBEROF
  324.  
  325. } playType_t;
  326.  
  327.  
  328. #define stringIDExpand(str, strEnum)    str, strEnum, ENUM2STRING(strEnum)
  329.  
  330. #endif // IGINTERFACE_H_INC